<?php
if(isset($_POST['caption']))
	{
		$caption = addslashes($_POST['caption']);
		$title = addslashes($_POST['title']);
		$align = addslashes($_POST['align']);
		$filename = addslashes($_POST['filename']);
		
		
		$image = $sql->fetch_object($sql->query('SELECT image_id FROM `'.$sql->prefix.'postimgs` WHERE location= '/images/".$filename.'));
		$image->image_id;
		
		$sql->query('UPDATE `'.$sql->prefix.'postimgs` SET name='".$title."', align='".$align."', description='".$caption."' WHERE image_id='".$image_id."'";		
	}
?>
<html>
	<head>
	<title>Image Upload</title>
	<style>
		#img_details {
			float: left; 
			clear: left;
		}
		
		label {
			vertical-align: top;
			position: relative;
			height: 25px;
			font-family: "Lucida Grande", Lucida, Verdana, sans-serif;
			font-size: 10px;
			float: left;
			clear: left;
		}
		
		label#caption {
			height: 100px;
		}
		
		label input,
		input#upload_status,
		input#filenamei,
		input#title,
		select#align {
			position: absolute;
			left: 100px;
			top: 0px;
		}
		
		input#upload_button {
			float: left;
			clear: both;
		}
	</style>
	</head>
	<body>
	<form action="#" method="POST" id="details">
		<input type="hidden" name="filename" value="<?php echo $_GET['pic']; ?>"id="filename">
		<label for="title">Picture Title:
			<input name="pictitle" type="text" size="20" maxlength="250" id="title">
		</label>
		<label for="align">Align
			<select name="align" id="align">
				<option value="R">R</option>
				<option value="R">L</option>
			</select>
		</label>
		<label for="photo" name="caption" id="caption">Image caption:<br>
			<textarea rows="5" cols="32" name="caption"></textarea>
		</label>
		<input type="submit" id="upload_button" value="save file">
	</form>
	</body>
</html>